/**
 *全局错误
 * @param errorCode
 * @constructor
 */
exports.throwError = function (code, res) {
    var error = {};
    error.ERROR_CODE = code;
    switch (code) {
        case 10000:
            error.ERROR_MESSAGE = '非法请求';
            break;
        case 10010:
            break;
        case 10020:
            error.ERROR_MESSAGE = '该资源需要授权才能访问';
            break;
        case 10030:
            error.ERROR_MESSAGE = ' 参数错误，请参考API文档';
            break;
        case 10040:
            error.ERROR_MESSAGE = ' 服务器忙';
            break;
        case 10050:
          error.ERROR_MESSAGE = '权限验证不通过';
          break;
        default :
            error.ERROR_MESSAGE = '参数错误，请参考API文档';
    }
    res.json(error);
    res.end();
};


exports.throwErrorMsg = function (msg, res) {
  var error = {};
  error.ERROR_CODE = 1;
  error.ERROR_MESSAGE = msg;
  res.json(error);
  res.end();
};


